package com.spring.framework.ioc.bean;

import com.spring.framework.config.IocConfig;
import com.spring.framework.model.learn.ReflectWarning;
import com.spring.framework.model.learn.School;
import com.spring.framework.model.learn.Student;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author xuweizhi
 * @since 2020/12/15 16:19
 */
public class SpringIocApplication extends ReflectWarning {

	public static void main(String[] args) {
		// 加载spring上下文
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(IocConfig.class);

		School school = (School) context.getBean("school");
		System.out.println(school.getHello());
		System.out.println(school.getAddress());

		Student student = (Student) context.getBean("student");
		System.out.println(student);

		String methodString = (String) context.getBean("getStringMethod");
		System.out.println(methodString);

		context.close();
	}
}
